package p.ithorns.support.license.config;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration;

/**
 * MybatisPlusConfig
 * TODO
 *
 * @author ithorns
 * @version 1.0
 * @date 2019/6/29 14:32
 */
@Configuration
@MapperScan("p.ithorns.support.license.mapper")
public class MybatisPlusConfig   {

//    @Bean
//    public ISqlInjector sqlInjector() {
//        return new MySqlInjector();
//    }

//    @Bean
//    public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
//        MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
//        sqlSessionFactoryBean.setDataSource(dataSource);
//        sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
//                .getResources("classpath:mapper/*.xml"));
//        sqlSessionFactoryBean.setTypeAliasesPackage("p.ithorns.integration.license.model.entity");
//        MybatisConfiguration mybatisConfiguration = new MybatisConfiguration();
//        mybatisConfiguration.setMapUnderscoreToCamelCase(true);
//
//
//        GlobalConfig config = new GlobalConfig();
//        config.setBanner(false);
//        // config.setMetaObjectHandler(new MyMetaObjectHandler());
//        // config.setSqlInjector(sqlInjector());
//
//        sqlSessionFactoryBean.setGlobalConfig(config);
//        sqlSessionFactoryBean.setConfiguration(mybatisConfiguration);
//        sqlSessionFactoryBean.setPlugins(mybatisPlusInterceptor());
//        // mybatisConfiguration.setLogImpl(StdOutImpl.class);
//
//        return sqlSessionFactoryBean.getObject();
//    }

//    @Bean
//    public MybatisPlusInterceptor mybatisPlusInterceptor() {
//        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
//        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
//        return interceptor;
//    }

}
